From a733559d5df9bafd4ffdad7bc3ee765cdb7ab90e Mon Sep 17 00:00:00 2001 From: robertl Date: Sat, 13 Mar 2010 17:53:04 +0000 Subject: [PATCH] Whack extension from Bushenell waypoints if given. --- bushnell.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bushnell.c b/bushnell.c index 2452975ce..5bcdea821 100644 --- a/bushnell.c +++ b/bushnell.c @@ -24,7 +24,7 @@ #define MYNAME "Bushnell" static gbfile *file_in; -static const char *ofname; +static char *ofname; static short_handle mkshort_handle = NULL; static @@ -157,7 +157,14 @@ rd_deinit(void) { static void wr_init(const char *fname) { - ofname = fname; + char *dot; + + ofname = xstrdup(fname); + + // If user provided an extension, whack it. + dot = strchr(ofname, '.'); + if (dot) *dot = 0; + static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" ".-/\\~@#$%^&*()_+=<>" "abcdefghijklmnopqrstuvwxyz"; @@ -170,7 +177,7 @@ wr_init(const char *fname) { static void wr_deinit(void) { mkshort_del_handle(&mkshort_handle); - + xfree(ofname); } /* -- 2.30.2